﻿using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Model;
using YouHP.DALFactory;
using YouHP.Utility;

namespace YouHP.BLL
{
    public class ActivityNewsBLL
    {
        #region Singleton
        static ActivityNewsBLL _Instance;
        public static ActivityNewsBLL Instance
        {
            get
            {
                if (_Instance == null)
                {
                    _Instance = new ActivityNewsBLL();
                }
                return _Instance;
            }
        }
        #endregion

        #region basic operations
        public bool AddActivityNews(ActivityNewsInfo info)
        {
            return DataAccess.ActivityNewsDAL.AddActivityNews(info);
        }

        public bool UpdateActivityNews(ActivityNewsInfo info)
        {
            return DataAccess.ActivityNewsDAL.UpdateActivityNews(info);
        }

        public bool DeleteActivityNews(int[] ids)
        {
            return DataAccess.ActivityNewsDAL.DeleteActivityNews(ids);
        }

        public ActivityNewsInfo GetActivityNewsInfo(int id)
        {
            return DataAccess.ActivityNewsDAL.GetActivityNewsInfo(id);
        }
        #endregion

        #region list and search operations
        public List<ActivityNewsInfo> GetActivityNewsList(int pageSize, int pageIndex, out int count)
        {
            return DataAccess.ActivityNewsDAL.GetActivityNewsList(pageSize, pageIndex, out count);
        }

        /*search for management*/
        public List<ActivityNewsInfo> GetAllActivityNewsByName(string keyword)
        {
            int count = 0;
            return DataAccess.ActivityNewsDAL.GetActivityNewsByName(Constants.maxPageSize, 1, keyword, out count);
        }
        #endregion
    }
}